<script setup>
import { ref } from 'vue'
import axios from 'axios'

const username = ref('')
const password = ref('')
const login = () => {
let request = axios.create({
  baseURL: '/api',
  timeout: 5000

})
request.get('/user/login', {params:
  {username: username.value,
  password: password.value}
}).then(res => {
  console.log(res.data)
}).catch(err => {
  console.log(err)
})
}
</script>

<template>

  <div>
    <p>
    用户名:
    <input type="text" v-model="username"></input>
    </p>
  <p>
    密码:
    <input type="password" v-model="password"></input>
    </p>
    <button @click="login">登录</button>
  </div>

</template>

<style scoped></style>